package com.example.mark.vo;

import lombok.Data;

import java.io.Serializable;

/**
 * 返回结果实体
 *
 * @param <T>
 */
@Data
public class Result<T> implements Serializable {
    private String msg;
    private String code;
    private T data;
    private String serverUrl;

    public Result() {

    }

    public Result(T data) {
        this.code = "200";
        this.msg = "SUCCESS";
        this.data = data;
    }

    public Result(T data, String serverUrl) {
        this.code ="200";
        this.msg = "SUCCESS";
        this.data = data;
        this.serverUrl = serverUrl;
    }

    public Result(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }




    public static Result error(String msg) {
        Result r = new Result();
        r.setCode("-1");
        r.setMsg(msg);
        return r;
    }

    public static Result error(String code, String msg) {
        Result r = new Result();
        r.setCode(code);
        r.setMsg(msg);
        return r;
    }
}
